/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FrameWork.Objects;

import FrameWork.GameScreen;
import FrameWork.Objects.Character.Player;
import FrameWork.Rectangle;
import java.util.Random;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.Sprite;

/**
 *
 * @author ASUS
 */
public class MyObject {
    
    protected Sprite    m_Sprite;
    protected int       m_CurFrame;
    protected float     m_SaveTimeAni, m_TimeAni;
    protected float     m_TimeUpdate;
    protected int       m_X, m_Y;
    protected int       m_SizeX, m_SizeY;
    protected int       m_ID;
    protected int       m_STATUS, m_OldStatus;
    protected int       m_Map[][];
    protected int       m_HeightMap;
    protected int       m_WidthMap;
    protected Random    m_Ran;
    
     public void setMap (int _Map[][]){
        m_Map = _Map;
    }
    public Rectangle getRect (){
        return new Rectangle(m_X * 30, m_Y * 30, m_SizeX, m_SizeY);
    }

    public int getCurFrame() {
        return m_CurFrame;
    }

    public int getSizeX() {
        return m_SizeX;
    }

    public int getSizeY() {
        return m_SizeY;
    }

    public void setSizeX(int m_SizeX) {
        this.m_SizeX = m_SizeX;
    }

    public void setSizeY(int m_SizeY) {
        this.m_SizeY = m_SizeY;
    }
    
    public void setPosition (int _x,int _y){
        m_X = _x;
        m_Y = _y;
    }
    
     public int getID (){
        return m_ID;
    }
    
    public int getX (){
        return m_X;
    }
    public int getY (){
        return m_Y;
    }

    public Sprite getSprite() {
        return m_Sprite;
    }

    public void setSprite(Sprite m_Sprite) {
        this.m_Sprite = m_Sprite;
    }
    
    public void setTimeAnimation (float _TimeAni){
        m_TimeAni = _TimeAni;
    }

    public int getOldStatus() {
        return m_OldStatus;
    }

    public int getSTATUS() {
        return m_STATUS;
    }

    public void setOldStatus(int m_OldStatus) {
        this.m_OldStatus = m_OldStatus;
    }

    public void setSTATUS(int m_STATUS) {
        this.m_STATUS = m_STATUS;
    }
    
    public void setCurFrame(int m_CurFrame) {
        this.m_CurFrame = m_CurFrame;
    }
    
    public void Active (Player _Player){
        
    }
    public MyObject (MyObject _Object){
        m_X             = _Object.m_X;
        m_Y             = _Object.m_Y;
        m_ID            = _Object.m_ID;
        m_SizeX         = _Object.m_SizeX;
        m_SizeY         = _Object.m_SizeY;
        m_TimeAni       = _Object.m_TimeAni;
        m_STATUS        = _Object.m_STATUS;
        m_SaveTimeAni   = _Object.m_SaveTimeAni;
        m_CurFrame      = _Object.m_CurFrame;
        m_TimeUpdate    = 0;
         m_Ran           = new  Random();
    }
    public MyObject(int _X,int _Y, int _SizeX, int _SizeY,
            float _TimeAni,
            int _Map[][],int _Width, int _Height,
            int _ID){
        m_X             = _X;
        m_Y             = _Y;
        m_SizeX         = _SizeX;
        m_SizeY         = _SizeY;
        m_TimeAni       = _TimeAni;
        m_SaveTimeAni   = 0;
        m_CurFrame      = 0;
        m_TimeUpdate    = 0;
        m_Ran           = new  Random();
        m_Map           =_Map;
        m_WidthMap      = _Width;
        m_HeightMap     = _Height;
        m_ID            = _ID;
    }
    
    public boolean CheckCollision(MyObject _Object){
        if(getRect().Intersects(_Object.getRect()))
            return true;
        return false;
    }
    public void ActionCollision (MyObject _Object){
        
    }
            
    public void UpdateMove (float _Time,int _Terrain[][]){
    }
    
    public void UpdateAnimation (float _Time){

    }
    
    public void Update(float _Time,int _Terrain[][]){
        UpdateAnimation(_Time);
        UpdateMove(_Time,_Terrain);
    }
    
    public void Draw (Graphics _Graphics){
    }
    public void DrawScreen (Graphics _Graphics,GameScreen _Screen){
    }
}
